<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>论坛热帖</title>
    <link href="css/css.css" rel="stylesheet" type="text/css">
</head>

<body>
    <header>
        <div class="head_c">
            <!--头部-->
            <div class="top">
                <div class="top_left">欢迎光临悠游行！</div>
                <div class="top_right" style="display: flex;" id="login_signup_area">
                    <div class="top_right"><a href="login.html">登录</a><a href="zhuce.html">注册</a></div>
                </div>
                <div class="top_right" style="display: flex;" id="logout_area">
                    <a class="top_right" id="login_info" style="font-weight: bold;">用户：15159241643</a>
                    <div class="top_right logout_button" onclick="logout()">退出登录</div>
                </div>
            </div>
        </div>
    </header>

    <!--导航-->
    <nav>
        <ul>
            <li><a href="index.html">网站首页</a></li>
            <li><a href="jingdian.html">著名景点</a></li>
            <li><a href="luxian.html">推荐路线</a></li>
            <li><a href="jiudian.html">酒店入住</a></li>
            <li class="on"><a href="luntan.html">论坛热帖</a></li>
             
        </ul>
    </nav>

    <!--banner-->
    <div class="banner"></div>
    <div class="lijiang">
        <div class="jingdian_tittle">论坛热帖</div>
    </div>

    <footer>悠游行</footer>
</body>

</html>
<script src="./js/utils.js"></script>
<script>
    display_login_info();
    display_post();
    function display_post() {
        api = baseUrl2 + `/post/get-by-id?id=${getCookieValue("selected_post_id")}`;
        fetch(api, {
            method: "GET",
            headers: {
                "Content-Type": "application/json",
            }
        }).then(response => response.json())
            .then(data => {
                console.log(data);
                item = data["data"];
                table = document.querySelector(".jingdian_tittle");
                table.innerHTML = `
                    <h2 style="color:rgb(0,0,0)">${item.title}</h2>
                    <p style="font-size:24px; margin-top:14px;">${item.content}</p>
                `;
            }).catch(error => {
                console.error(error);
            })

    }
</script>